# Handels loading and saving files

import cPickle, csv

def saveFile(silentAuctionItems, liveAuctionItems, giveAwayItems, cashDonations, doorPrizes, raffleItems, expenses, fileLocation):
	# The number in the fileList is the file structure version
	fileList = [0, silentAuctionItems, liveAuctionItems, giveAwayItems, cashDonations, doorPrizes, raffleItems, expenses] # The list that will be "pickled"
	saveFile = file(fileLocation, 'wb') # Open the file (binary for cross platform purposes)
	cPickle.dump(fileList, saveFile) # Dump the file list
	saveFile.close() # We are good!

def openFile(fileLocation):
	readFile = file(fileLocation, 'rb') # Open the file (binary for cross platform purposes
	fileList = cPickle.load(readFile) # Unpickle
	readFile.close() # Free up the file
	# Start at 1 because of the file structure version number
	return fileList[1], fileList[2], fileList[3], fileList[4], fileList[5], fileList[6], fileList[7]
	
def exportAsCSV(itemsList, fileLocation):
	print "exportAsCSV has not been implemented"

def importFromCSV(fileLocation):
	print "importFromCSV has not been implemented"
